export default [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: () => import('@/page/Home'),
    //是否显示底部（footer）
    meta: { show: true }
  },
  {
    path: '/login',
    component: () => import('@/page/Login'),
    meta: { show: false }
  },
  {
    path: '/register',
    component: () => import('@/page/Register'),
    meta: { show: false }
  },
  {
    name: 'search',
    path: '/search/:keyword?',
    component: () => import('@/page/Search'),
    meta: { show: true }
  },
  {
    path: '/detail/:skuid',
    component: () => import('@/page/Detail'),
    meta: { show: true }
  },
  {
    name: 'AddCartSuccess',
    path: '/addcartsuccess',
    component: () => import('@/page/AddCartSuccess'),
    meta: { show: true }
  },
  {
    name: 'ShopCart',
    path: '/shopcart',
    component: () => import('@/page/ShopCart'),
    meta: { show: true }
  },
  {
    path: '/trade',
    component: () => import('@/page/Trade'),
    meta: { show: true },
    beforeEnter: (to, from, next) => {
      if (from.path == '/shopcart') {
        next()
      } else {
        next(false)
      }
    }
  },
  {
    path: '/pay',
    component: () => import('@/page/Pay'),
    meta: { show: true },
    beforeEnter: (to, from, next) => {
      if (from.path == '/pay') {
        next()
      } else {
        next(false)
      }
    }
  },
  {
    path: '/paysuccess',
    component: () => import('@/page/PaySuccess'),
    meta: { show: true }
  },
  {
    path: '/center',
    component: () => import('@/page/Center/MyOrder'),
    children: [
      {
        // path: '/center/myorder',
        path: 'myorder',
        component: () => import('@/page/Center/MyOrder')
      },
      {
        path: 'grouporder',
        component: () => import('@/page/Center/GroupOrder')
      },
      {
        path: '',
        redirect: 'myorder'
      }
    ]
  }
]
